# Library of useful functions

# Returns the nearest value by tolerance
# 20% (E6), 10% (E12), 5% (E24), 2% (E48), 1% (E96), 0.5% (E192),
# 0.25% (E192), 0.1% (E192)

# 20%
E6 = [10, 15, 22, 33, 47, 68];
# 10%
E12 = [10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82 ];
# 5%
E24 = [ 10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82
        11, 13, 16, 20, 24, 30, 36, 43, 51, 62, 75, 91 ];
# 2%
E48 = [ 100, 121, 147, 178, 215, 261, 316, 383, 464, 562, 681, 825
        105, 127, 154, 187, 226, 274, 332, 402, 487, 590, 715, 866
        110, 133, 162, 196, 237, 287, 348, 422, 511, 619, 750, 909
        115, 140, 169, 205, 249, 301, 365, 442, 536, 649, 787, 953 ];
# 1%
E96 = [ 100, 121, 147, 178, 215, 261, 316, 383, 464, 562, 681, 825
        102, 124, 150, 182, 221, 267, 324, 392, 475, 576, 698, 845
        105, 127, 154, 187, 226, 274, 332, 402, 487, 590, 715, 866
        107, 130, 158, 191, 232, 280, 340, 412, 499, 604, 732, 887
        110, 133, 162, 196, 237, 287, 348, 422, 511, 619, 750, 909
        113, 137, 165, 200, 243, 294, 357, 432, 523, 634, 768, 931
        115, 140, 169, 205, 249, 301, 365, 442, 536, 649, 787, 953
        118, 143, 174, 210, 255, 309, 374, 453, 549, 665, 806, 976 ];
# 0.5%
E192 = [ 100, 121, 147, 178, 215, 261, 316, 383, 464, 562, 681, 825
         101, 123, 149, 180, 218, 264, 320, 388, 470, 569, 690, 835
         102, 124, 150, 182, 221, 267, 324, 392, 475, 576, 698, 845
         104, 126, 152, 184, 223, 271, 328, 397, 481, 583, 706, 856
         105, 127, 154, 187, 226, 274, 332, 402, 487, 590, 715, 866
         106, 129, 156, 189, 229, 277, 336, 407, 493, 597, 723, 876
         107, 130, 158, 191, 232, 280, 340, 412, 499, 604, 732, 887
         109, 132, 160, 193, 234, 284, 344, 417, 505, 612, 741, 898
         110, 133, 162, 196, 237, 287, 348, 422, 511, 619, 750, 909
         111, 135, 164, 198, 240, 291, 352, 427, 517, 626, 759, 920
         113, 137, 165, 200, 243, 294, 357, 432, 523, 634, 768, 931
         114, 138, 167, 203, 246, 298, 361, 437, 530, 642, 777, 942
         115, 140, 169, 205, 249, 301, 365, 442, 536, 649, 787, 953
         117, 142, 172, 208, 252, 305, 370, 448, 542, 657, 796, 965
         118, 143, 174, 210, 255, 309, 374, 453, 549, 665, 806, 976
         120, 145, 176, 213, 258, 312, 379, 459, 556, 673, 816, 988 ];


# 0.25%
#E192
# 0.1%
#E192 



# if negative, return zero.
# round decimals first?
